/* *********************************************************************
 R2 module of MPX for Group 3 -2.01
 File Name:   PCB.h 
 Author:    Y.Tu  
 Version 2.0 
 Date:  10/01/2008
 Purpose:  Header file containing PCB definition for R2 module 

**********************************************************************/


#define MAX_PCB_NAME 8
#define PCB_LEN sizeof(struct mpx_pcb)

#define RUNNING 1000
#define READY   2000
#define BLOCKED 3000


/* Type and structure definitions */
typedef struct mpx_pcb {

/* The following four members will be used in R2 */ 
int pcb_id;        /* ID  */
char pcb_name[MAX_PCB_NAME];    /* external name */
int pcb_state;     /* process state */   
int pcb_priority;  /* priority  */ 


/* The following four members will be used later */
unsigned char*  pcb_memory;  
unsigned char*  pcb_resource; 
unsigned char*  pcb_context;
unsigned char*  pcb_account; 

} PCB; 


/* Supporting function prototypes for PCB manipulation */
PCB* allo_pcb(void);
int free_pcb (PCB* p );
PCB* set_pcb(PCB* p,int id, char name[MAX_PCB_NAME], int state, int pri);


/* other functions, will be added later */ 
/***************************
int loca_pcb ( );
int ins_pcb( );  
rem_pcb();

****************************/
